#! /usr/bin/env python
# -*- coding: utf-8 -*-

# Copyright (c) JoinQuant Development Team
# Author: Huayong Kuang <kuanghuayong@joinquant.com>

import sqlalchemy


engine = sqlalchemy.create_engine('mysql://root:123456@127.0.0.1:33306/dev')
connection = engine.connect()
trans = connection.begin()
try:
    connection.execute("insert into tt001 (c2) values ('hello')")
    connection.execute("insert into tt001 (c2) values ('hello')")
    connection.execute("insert into tt002 (c2) values ('hello')")
except Exception:
    print("-" * 100)
    #trans.rollback()
    raise

print("=" * 100)
trans.commit()
